//
//  NavigationHeadView.m
//  CoachsBook
//
//  Created by MaBookPro on 2022/8/8.
//

#import "NavigationHeadView.h"

@implementation NavigationHeadView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        [self CreateUIinterface];
    }
    return self;
}


#pragma mark - 创建界面
-(void)CreateUIinterface
{
    
//    self.backgroundColor = rgba(230, 84, 84, 1.0);

    _line = [[UIImageView alloc] initWithFrame:CGRectMake(0, SafeAreaTopHight- 0.5, APPwidth, 0.5)];
    _line.backgroundColor = rgba(238, 238, 238, 1);
    [self addSubview:_line];
    _line.hidden = YES;

    
//    _leftlabel = [[UILabel alloc]initWithFrame:CGRectMake(20, SafeAreaTopHight/2-5, 150,20)];
//    _leftlabel.font = [UIFont systemFontOfSize:18];
//    _leftlabel.textColor = [UIColor whiteColor];
//    _leftlabel.textAlignment = NSTextAlignmentCenter;
//    [self addSubview:_leftlabel];
    
    
    
    _titlelabel = [[UILabel alloc] initWithFrame:CGRectMake(APPwidth/2-(APPwidth-100)/2, SafeAreaTopHight/2-5, APPwidth-100, 20)];
    _titlelabel.textAlignment = 1;
//    _titlelabel.font = [UIFont fontWithName:@"PingFang-SC-Medium" size:18];
    _titlelabel.font = [UIFont fontWithName:@"Source Han Sans CN" size:18];
    _titlelabel.textColor = [UIColor whiteColor];
    _titlelabel.font = [UIFont systemFontOfSize:18 weight:bold];
    [self addSubview:_titlelabel];
    
    
    _backbtn = [[UIButton alloc]initWithFrame:CGRectMake(20, SafeAreaTopHight/2-5, 20, 20)];
    [_backbtn setBackgroundImage:[UIImage imageNamed:@"returnicon"] forState:0];
    [self addSubview:_backbtn];

    

    _rightbtn = [[UIButton alloc] initWithFrame:CGRectMake(APPwidth-100, SafeAreaTopHight/2-5, 80, 20)];
    _rightbtn.titleLabel.font = [UIFont systemFontOfSize:14];
    [_rightbtn setTitleColor:[UIColor whiteColor] forState:0];
    [self addSubview:_rightbtn];
    _rightbtn.hidden = YES;

//    _rightlabel = [[UILabel alloc]initWithFrame:CGRectMake(APPwidth-100, SafeAreaTopHight/2-10, 80, 20)];
//    _rightlabel.font = [UIFont systemFontOfSize:14];
//    _rightlabel.textAlignment = 2;
//    _rightlabel.textAlignment = NSTextAlignmentCenter;
//    [self addSubview:_rightlabel];
    
//    _rightimg = [[UIImageView alloc]initWithFrame:CGRectMake(APPwidth-60, SafeAreaTopHight/2-10, 20, 20)];
//    [self addSubview:_rightimg];


    if (iPhoneXBool) {
        
        _titlelabel.frame = CGRectMake(100, self.frame.size.height/2, APPwidth-200, 40);
        
        _backbtn.frame = CGRectMake(20, self.frame.size.height/2+10, 20, 20);
        
        _rightbtn.frame = CGRectMake(APPwidth-100, self.frame.size.height/2+10, 80, 20);
        
        _leftlabel.frame = CGRectMake(20, self.frame.size.height/2, 80, 40);
        
        _rightlabel.frame = CGRectMake(APPwidth-100, self.frame.size.height/2, 80, 40);

    }
    
    
}

@end
